package at.fhj.swd.pse.data;

import java.util.ArrayList;
import java.util.List;

import at.fhj.swd.pse.entities.News;

/**
 * @author Markus Prutsch
 **/

public class NewsDAOMock implements NewsDAO {

	List<News> m_lstNews;

	public NewsDAOMock() {
		this.m_lstNews = new ArrayList<News>();
	}

	@Override
	public List<News> getAllOrderedByCreation() {
		return this.m_lstNews;
	}

	@Override
	public News insert(final News news) {
		this.m_lstNews.add(news);
		return news;
	}

	@Override
	public News update(final News news) {
		for (int i = 0; i < this.m_lstNews.size(); i++) {
			if (this.m_lstNews.get(i).getId() == news.getId()) {
				return this.m_lstNews.set(i, news);
			}
		}
		return null;
	}

	@Override
	public News get(final int id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<News> getAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void remove(final News entity) {
		// TODO Auto-generated method stub

	}

}